package com.test;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Demo {

    public static void main(String[] args) {

        String strSource="sites.site3.com";

        String[] split = strSource.split("\\.");

        List<String> sourceList = Arrays.stream(split).collect(Collectors.toList());

        System.out.println(sourceList);

        String s = sourceList.get(sourceList.size() - 1);

        System.out.println(s);


        sourceList.remove(s);
        System.out.println(sourceList);

    }

}
